package Test;

import java.util.List;

import javax.swing.JFrame;

import com.surekam.library.model.BookCategory;
import com.surekam.library.service.serviceImp.bookManageImp.IBookCategoryServiceImp;
import com.surekam.library.view.common.DataTree;

public class BookCategoryChildrenTest {
	private static DataTree tree ;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		BookCategory bookCategory = new IBookCategoryServiceImp().getBookCategoryWithTree(21);
		JFrame f = new JFrame();
		tree = new DataTree(bookCategory);
		//System.out.println("MAIN:"+bookCategory +" "+bookCategory.getChildrenList().get(0).getCategoryName());
		
		//print(bookCategory);
		//tree.addMouseListener(getMouseAdapter());
		f.add(tree);
		f.pack() ;
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setVisible(true);
	}

	public static void print(BookCategory bookCategory){
		
		List<BookCategory> list = bookCategory.getChildrenList();
		System.out.println(bookCategory.getCategoryName());
		for (BookCategory bookCategory2 : list) {
			print(bookCategory2);
		}
	}
}
